package shell.bootstraps.controller
{
	import com.hobbit.analyze.AssetsManager;
	import com.hobbit.analyze.core.IConfigManager;
	import com.hobbit.net.NetConfig;
	import com.hobbit.net.NetService;
	import com.hobbit.net.core.INetConfig;
	import com.hobbit.net.core.INetService;
	import com.hobbit.ui.viewbase.IViewLayers;
	
	import feathers.core.PopUpManager;
	
	import org.robotlegs.utilities.modular.mvcs.StarlingModuleSignalCommand;
	
	import shell.bootstraps.service.IPreloadService;
	import shell.bootstraps.service.PreloadService;
	import shell.bootstraps.signals.SetupNetConfig;
	import shell.bootstraps.signals.StartAssetsLoading;
	import shell.config.ConfigManager;
	import shell.view.ShellModuleMediator;
	import shell.view.components.ShellRootView;
	
	public class BootstrapStartCommand extends StarlingModuleSignalCommand
	{
		public function BootstrapStartCommand()
		{
			super();
		}
		
		override public function execute():void
		{
			// manager setups
			PopUpManager.popUpLayer = (contextView as IViewLayers).popUpLayer;
			// add tip manager
			injector.mapValue(AssetsManager, AssetsManager.getInstance());
			injector.mapValue(IConfigManager, ConfigManager.getInstance());
			//////////////
			
			injector.mapSingletonOf(IPreloadService, PreloadService);
			injector.mapSingletonOf(INetService, NetService);
			injector.mapSingletonOf(INetConfig, NetConfig);
			
			signalCommandMap.mapSignalClass(SetupNetConfig, SetupNetConfigCommand, true);
			
			mediatorMap.mapView(ShellRootView, ShellModuleMediator);
			
			var startAssetsLoading:StartAssetsLoading = new StartAssetsLoading();
			signalCommandMap.mapSignal(startAssetsLoading, StartAssetsLoadingCommand, true);
			startAssetsLoading.dispatch();
		}
	}
}